home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.1 (Developer) [x86] / NeXT Step 3.1 Intel dev.cdr.dmg / NextDeveloper / Headers / driverkit / IOLogicalDisk.h < prev    next >
Encoding:
Text File  |  1993-02-17  |  3.1 KB  |  107 lines

  1. /*     Copyright (c) 1991 NeXT Computer, Inc.  All rights reserved. 
  2.  *
  3.  * IOLogicalDisk.h - Public interface for Logical Disk Object.
  4.  *
  5.  * HISTORY
  6.  * 05-Mar-91    Doug Mitchell at NeXT
  7.  *      Created. 
  8.  *
  9.  * IOLogicalDisk is an abstract superclass which conceptually overlays 
  10.  * the IODiskDevice class and provides "logical partition" functionality. 
  11.  * Unix File System I/O goes thru a subclass of IOLogicalDisk; other I/O 
  12.  * usually goes thru a subclass of IODiskDevice (like SCSIDisk).
  13.  *
  14.  * The main functionality provided by an IOLogicalDisk is to map read and write
  15.  * requests to a physical device which has diffferent physical 
  16.  * characteristics (block size, offset of partitions, etc.) than the 
  17.  * IOLogicalDisk.
  18.  *
  19.  * An IOLogicalDisk is always associated with an IODiskDevice which actually 
  20.  * performs all of IOLogicalDisk's I/O; this IODiskDevice's id is kept in 
  21.  * _physDevice. An IOLogicalDisk is always in the same task as its associated
  22.  * _physDevice.
  23.  * 
  24.  * IODiskDevice's _logicalDisk instance variable is used to chain together all
  25.  * of the IOLogicalDisks attached to a particular physDevice. In an 
  26.  * IOLogicalDisk, logicalDisk points to the next IOLogicalDisk in a chain -
  27.  * e.g., partition a's logicalDisk variable points to the IOLogicalDisk
  28.  * instance for partition b. The chain is nil-terminated.
  29.  */
  30.  
  31. #import <driverkit/return.h>
  32. #import <driverkit/IODisk.h>
  33. #ifdef    KERNEL
  34. #import <mach/mach_interface.h>
  35. #else    KERNEL
  36. #import <mach/mach.h>
  37. #endif    KERNEL
  38.  
  39. @interface IOLogicalDisk:IODisk <IODiskReadingAndWriting>
  40.  
  41. /*
  42.  * Some notes on IODisk instance variables:
  43.  *
  44.  * -- The formatted flag is a don't care for LogicalDisk and its subclasses.
  45.  *    This flag is only for use by other device-specific subclasses of 
  46.  *    IODiskDevice.
  47.  *
  48.  * -- The removable flag is always a copy of a LogicalDisk's physicalDisk's
  49.  *    removable flag. This is set in the connectToPhysicalDisk method.
  50.  */
  51. {
  52. @private
  53.     id        _physicalDisk;        /* a pointer to the
  54.                          * IODiskDevice which actually
  55.                          * does our work */
  56.     unsigned    _partitionBase;        /* offset from start of
  57.                          * physDevice in
  58.                          * blocSize blocks */
  59.     unsigned    _physicalBlockSize;    /* blockSize of physDevice,
  60.                          * cached here for efficiency
  61.                          */
  62.     BOOL        _instanceOpen;
  63. }
  64.  
  65. /*
  66.  * Other methods Implemented by IOLogicalDisk.
  67.  */
  68. /*
  69.  * Determine if this LogicalDisk (or any other subsequent logical disks in the
  70.  * _nextLogicalDisk list) are currently open. Returns 0 if none open, else
  71.  * 1.
  72.  */
  73. - (BOOL)isOpen;
  74.  
  75. /*
  76.  * Determine if any logical disks in the _physicalDisk's entire 
  77.  * _nextLogicalDisk chain except for self are open.
  78.  */
  79. - (BOOL)isAnyOtherOpen;
  80.  
  81. /*
  82.  * Free self and any objects in logicalDisk chain.
  83.  */
  84. - free;
  85.     
  86. /*
  87.  * Open a connection to physical device.
  88.  */
  89. - (IOReturn)connectToPhysicalDisk : physicalDisk;
  90.  
  91. /*
  92.  * Get/set local instance variables.
  93.  */
  94. - (void)setPartitionBase    : (unsigned)partBase;
  95. - physicalDisk;
  96. - (void)setPhysicalBlockSize     : (unsigned)size;
  97. - (u_int)physicalBlockSize;
  98. - (BOOL)isInstanceOpen;
  99. - (void)setInstanceOpen        : (BOOL)isOpen;
  100.  
  101. /*
  102.  * Passed on to _physDevice.
  103.  */
  104. - (IOReturn)isDiskReady        : (BOOL)prompt;
  105.   
  106. @end
  107.